#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <map>
using namespace std; 
class Solution {
public:
    int dp[100];
    int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
        dp[0] = 1;
        for (int i = 0; i < obstacleGrid.size(); i++)
        {
            dp[0] = (1 - obstacleGrid[i][0]) && dp[0];
            for (int j = 1; j < obstacleGrid[i].size(); j++)
            {
                if (obstacleGrid[i][j])dp[j] = 0;
                else dp[j] = dp[j] + dp[j - 1];
            }

        }
        return dp[obstacleGrid[0].size() - 1];
    }
};